﻿@model BannerModel
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form" wid200 lay-filter="">
                <input asp-for="Id" type="hidden" />
                <div class="layui-form-item">
                    <u-label asp-for="Name" />
                    <div class="layui-input-inline">
                        <u-editor asp-for="Name" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <u-label asp-for="ClassName" />
                    <div class="layui-input-inline">
                        <u-editor asp-for="ClassName" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <u-label asp-for="ZoneName" />
                    <div class="layui-input-inline">
                        <u-editor asp-for="ZoneName" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <u-label asp-for="TemplateName" />
                    <div class="layui-input-inline">
                        <u-editor asp-for="TemplateName" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button id="set_system_submit_btn" style="display:none" class="layui-btn" lay-submit lay-filter="set_system_submit_btn">确认保存</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script>
    layui.use(['index'], function () {
        var $ = layui.$
            , form = layui.form
            ,active = { }
        form.on('submit(set_system_submit_btn)', function (obj) {
            var index = layer.load(2, { shade: false });
          var field = obj.field; //获取提交的字段
            //layer.msg(JSON.stringify(obj.field));
            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.post('@Url.Action("Edit")', field, function (rep) {
                layer.close(index);
                layer.msg("保存成功,即将自动关闭", { time: 2 * 1000 }, function () {
                    var iframe_index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    console.log("当前iframe层的索引:" + iframe_index + "==window.name:" + window.name);
                    parent.layer.close(iframe_index); //再执行关闭
                    window.parent.location.reload();
                });
            });
            
            return false;
    });
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    });
</script>

